<?php

namespace App\Libs\Company\SheetTemplateHandler\Aggregate;

use App\Libs\Company\SheetTemplateHandler\Aggregate\AbstractTemplate;

class Template215 extends AbstractTemplate
{
    public $dataStartRow = 3;

    public function generateAbstract()
    {
        $this->renderHeader();
        $this->output['sheets']['sheet-01']['cellData']['0']['0'] = $this->createTitleCell("日喀则市{$this->task->year}年{$this->task->key}月\r{$this->template->name}");

        $sn = 1;
        foreach ($this->task->subTasks as $st) {
            $this->output['sheets']['sheet-01']['cellData'][] = [
                ['v' => $sn++, 's' => 'CENTER'],
                ['v' => str_replace('旅游局', '', $st->district->name), 's' => 'CENTER'],
                ['v' => $st->data['sheets']['sheet-01']['cellData'][3][0]['v'], 't' => 2],
                ['v' => $st->data['sheets']['sheet-01']['cellData'][3][1]['v'], 't' => 2],
                ['v' => $st->data['sheets']['sheet-01']['cellData'][3][2]['v'], 't' => 2],
                ['v' => $st->data['sheets']['sheet-01']['cellData'][3][3]['v'], 't' => 2],
                ['v' => $st->data['sheets']['sheet-01']['cellData'][3][4]['v'], 't' => 2],
                ['v' => $st->data['sheets']['sheet-01']['cellData'][3][5]['v'], 't' => 2],
                ['v' => $st->data['sheets']['sheet-01']['cellData'][3][6]['v'], 't' => 2],
                ['v' => $st->data['sheets']['sheet-01']['cellData'][3][7]['v'], 't' => 2],
                ['v' => $st->data['sheets']['sheet-01']['cellData'][3][8]['v'], 't' => 2],
                ['v' => $st->data['sheets']['sheet-01']['cellData'][3][9]['v'], 't' => 2],
                ['v' => $st->data['sheets']['sheet-01']['cellData'][3][10]['v'], 't' => 2],
                ['v' => $st->data['sheets']['sheet-01']['cellData'][3][11]['v'], 't' => 2],
                ['v' => $st->data['sheets']['sheet-01']['cellData'][3][12]['v'], 't' => 2],
            ];
        }
        $this->dataEndRow = $this->dataStartRow + $sn - 2;

        $this->renderFooter();
        return $this->output;
    }
}
